<?php
//
//  VictoryCMS - Content managment system and framework.
//  Copyright (C) 2009  Lewis Gunsch
//
//  This file is part of VictoryCMS.
//  
//  VictoryCMS is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  VictoryCMS is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with VictoryCMS.  If not, see <http://www.gnu.org/licenses/>.

/**
 * VictoryCMS - PermissionTest
 * 
 * @license http://www.gnu.org/licenses/gpl.html
 * @author Lewis Gunsch
 * @filesource
 * @package DisplayablePages
 */

/**
 * For testing permissions
 * 
 * @package DisplayablePages
 */
class PermissionTest implements DisplayablePage {

	/** @see DisplayablePage#getTitle() */
	public function getTitle() {
		return "Permission Test";
	}

	/** @see DisplayablePage#getName() */
	public function getName() {
		return "Permission Test";
	}

	/** @see DisplayablePage#getDescription() */
	public function getDescription() {
		return "Tests the Permission Table";
	}

	/** @see DisplayablePage#getKeywords() */
	public function getKeywords() {
		return "";
	}

	/** @see DisplayablePage#getHeaderInfo() */
	public function getHeaderInfo() {
		return "";
	}

	/** @see DisplayablePage#renderPage() */
	public function renderPage( $currentPage ) {
		$html = "";
		
		$db = VcmsDBFactory::createVcmsDb();
		
		$perm = new Permission();

		
		//$perm->setUpDb();
		/*$valid = $perm->isValid();
		echo "Valid: ".(($valid)? "true":"false")."<br/>";
		if ($valid == false) {
			$perm->setUpDb();
		}*/
		/*$valid = $perm->isValid();
		echo "Valid: ".(($valid)? "true":"false")."<br/>";
		$perm->tearDownDb();
		echo "Valid: ".(($valid)? "true":"false")."<br/>";
		$db->cleanUp();*/
		
		print_ar($perm->getPermissionList());
		
		return $html;
	}

	/** @see DisplayablePage#pagePreProcess() */
	public function pagePreProcess() {
		return;
	}

	/** @see DisplayablePage#getPagePermissionLevel() */
	public function getPagePermissionLevel() {
		return new Permission("anonymous");
	}
}
?>